package com.huike.web.controller.system;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.huike.clues.dto.ReportDto;
import com.huike.clues.service.LreportService;
import com.huike.common.core.controller.BaseController;
import com.huike.common.core.domain.AjaxResult;
import com.huike.common.core.page.TableDataInfo;
import com.sun.jna.platform.unix.X11;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.Map;

/**
 * @author 木子李
 */
@RestController
@RequestMapping("/report")
public class LreportController extends BaseController {
    @Autowired
    private LreportService lreportService;

    @GetMapping("/basicData/{beginTime}/{endTime}")
    public AjaxResult basicData(
            @PathVariable @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginTime,
            @PathVariable @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime
    ) {
        return AjaxResult.success(lreportService.selectCountByTime(beginTime, endTime));
    }

    @GetMapping("/todayData")
    public AjaxResult todayData() {
        return AjaxResult.success(lreportService.selectCountBytoday());
    }

    @GetMapping("/clueData/{beginTime}/{endTime}")
    public AjaxResult clueData(
            @PathVariable @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginTime,
            @PathVariable @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime
    )
    {
        return AjaxResult.success(lreportService.selectCountByClueData(beginTime,endTime));
    }
}
